import {lazy} from 'react'
import Home from './pages/Home'

// React.lazy() 允许你定义一个动态加载的组件。这有助于缩减 bundle 的体积，并延迟加载在初次渲染时未用到的组件。当用到时再加载
// 例如：引入Login，
export const routes = [
    {
        path: '/login',
        authCheckType: 'unauthed', //权限检测类型，登录页，如果不需要检测
        component: lazy(()=>import('./pages/Login'))
    },
    {
        path: '/register',
        authCheckType: 'unauthed', //权限检测类型，注册页，如果不需要检测
        component: lazy(()=>import('./pages/Register'))
    },
    {
        path: '/regist',
        authCheckType: 'unauthed', //权限检测类型，注册页，如果不需要检测
        component: lazy(()=>import('./pages/Regist'))
    },
    {
        path: '/',
        authCheckType: 'authed', //权限检测类型，如果需要检测
        component: lazy(()=>import('./pages/Home')),
        routes:[
            {
                path: '/video',
                authCheckType: 'authed', 
                component: lazy(()=>import('./component/home/Video'))
            },
            {
                path: '/upload',
                authCheckType: 'authed', 
                component: lazy(()=>import('./component/home/Upload'))
            },
            {
                path: '/',
                authCheckType: 'authed', 
                component: lazy(()=>import('./component/home/Home')),
                // routes: [
                //     {
                //         path: '/newsType=&2',
                //         authCheckType: 'authed', 
                //         component: lazy(()=>import('./'))
                //     },
                // ]
            },
        ]
    },
];